package com.eudon.design_pattern.structural.bridge.after;

import com.eudon.design_pattern.structural.bridge.Error;
import com.eudon.design_pattern.structural.bridge.after.notification.BugErrorNotify;
import com.eudon.design_pattern.structural.bridge.after.notification.ServerErrorNotify;
import com.eudon.design_pattern.structural.bridge.after.notification.WarnErrorNotify;
import com.eudon.design_pattern.structural.bridge.after.sender.EmailSender;
import com.eudon.design_pattern.structural.bridge.after.sender.TelephoneSender;
import com.eudon.design_pattern.structural.bridge.after.sender.WeChatSender;

/**
 * @author eudon
 * @description 使用示例
 * @date 2025/9/1
 * @email syd19970616@gmail.com
 * @address <a href="https://gitee.com/eudon">Gitee</a>
 */
public class Use {
    public static void main(String[] args) {
        notify(Error.SERVER);
    }

    private static boolean notify(Error error) {
        boolean send = true;
        if (error == Error.SERVER) {
            send = new ServerErrorNotify(new TelephoneSender()).send();
        } else if (error == Error.BUG) {
            send = new BugErrorNotify(new WeChatSender()).send();
        } else if (error == Error.WARN) {
            send = new WarnErrorNotify(new EmailSender()).send();
        }
        return send;
    }
}
